import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns : BasicColumn[] = [
	{
		title: '状态',
		align: "center",
		dataIndex: 'stats',
		customRender: ({ text }) => {
			if (text == 'Apply') return '申请中待审核'
			if (text == 'Active') return '审核通过邀请面试'
			if (text == 'passTheNoInterview') return '面试未通过'
			if (text == 'passTheInterview') return '面试通过'
			if (text == 'DisActive') return '审核未通过'
			if (text == 'Dimission') return '已离职'
			if (text == 'job') return '在职'
		}
	},
	{
		title: '领队id',
		align: "center",
		dataIndex: 'leaderid_dictText'
	},
	{
		title: '地址信息',
		align: "center",
		dataIndex: 'gis'
	},
	{
		title: '面试时间',
		align: "center",
		dataIndex: 'interviewtime'
	},
	{
		title: '联系人姓名',
		align: "center",
		dataIndex: 'linkname'
	},
	{
		title: '联系人电话',
		align: "center",
		dataIndex: 'linkphone'
	},
	{
		title: '职位',
		align: "center",
		dataIndex: 'job',
		customRender: ({ text }) => {
			if (text == 'DriverLeader') return '司机兼领队'
			if (text == 'Leader') return '领队'
		}
	},
	{
		title: '说明',
		align: "center",
		dataIndex: 'extinfors',
		customRender: ({ text }) => {
			if (text.length > 5) {
				return JSON.parse(text).explain
			} else {
				return ''
			}
		}
	},
];
//查询数据
export const searchFormSchema : FormSchema[] = [
];
//表单数据
export const formSchema : FormSchema[] = [
	/**
	 * ("Apply", "申请中待审核"), ("Active", "审核通过邀请面试"),("DisActive", "审核未通过..."),
	("passTheInterview", "面试通过"),
	("passTheNoInterview", "面试未通过...")
	 */
	{
		label: '审核状态',
		field: 'stats',
		component: 'RadioGroup',
		componentProps: {
			options: [
				{ label: '待审核', value: 'Apply' },
				{ label: '审核通过邀请面试', value: 'Active' },
				{ label: '审核未通过', value: 'DisActive' },
				{ label: '面试通过', value: 'passTheInterview' },
				{ label: '面试未通过', value: 'passTheNoInterview' },
				{ label: '已离职', value: 'Dimission' },
				{ label: '在职', value: 'job' },
			]
		},
		dynamicRules: ({ model, schema }) => {
			return [
				{
					required: true, message: '请输入状态'
				},
			];
		},
	},
	{
		label: '领队id',
		field: 'leaderid',
		component: 'Input',
		show: false
	},
	{
		label: '面试地址',
		field: 'gis',
		component: 'Input',
		slot: 'selectGisInfo',
		ifShow: ({ values }) => {
			return values.stats == 'Active'
		}
	},
	{
		label: '面试时间',
		field: 'interviewtime',
		component: 'DatePicker',
		componentProps: {
			showTime: true,
			valueFormat: 'YYYY-MM-DD HH:mm:ss'
		},
		ifShow: ({ values }) => {
			return values.stats == 'Active'
		}
	},
	{
		label: '联系人姓名',
		field: 'linkname',
		component: 'Input',
		ifShow: ({ values }) => {
			return values.stats == 'Active'
		}
	},
	{
		label: '联系人电话',
		field: 'linkphone',
		component: 'Input',
		ifShow: ({ values }) => {
			return values.stats == 'Active'
		}
	},
	{
		label: '职位',
		field: 'job',
		component: 'RadioGroup',
		componentProps: {
			options: [
				{ label: '司机兼领队', value: 'DriverLeader' },
				{ label: '领队', value: 'Leader' }
			]
		},
		ifShow: ({ values }) => {
			return values.stats == 'Active' || values.stats == 'job'
		}
	},
	{
		label: '说明',
		field: 'explain',
		component: 'InputTextArea',
		ifShow: ({ values }) => {
			return values.stats != 'Apply'
		}
	},
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData) : FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}